package garden {
	import mx.collections.ArrayCollection;
	import org.davekeen.flextrine.orm.FlextrineError;
	
	[Bindable]
	public class LeafEntityBase {
		
		[Transient]
		public var __isUnserialized__:Boolean;
		
		[Transient]
		public var __isInitialized__:Boolean = true;
		
		[Transient]
		public var __isCollectionInitializedMap__:Object = new Object();
		
		[Id]
		public var id:String;
		
		[Association]
		public function get branch():Branch { checkIsInitialized("branch"); return _branch; }
		public function set branch(value:Branch):void { _branch = value; }
		private var _branch:Branch;
		
		public function LeafEntityBase() {
		}
		
		public function toString():String {
			return "[Leaf id=" + id + "]";
		}
		
		private function checkIsInitialized(property:String):void {
			if (!__isInitialized__ && __isUnserialized__)
				throw new FlextrineError("Attempt to get property '" + property + "' on unitialized Leaf.  Consider using EntityManager::require or eager loading.", FlextrineError.ACCESSED_UNITIALIZED_ENTITY);
		}
		
	}

}
